﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Imageo.bintje;
using log4net;
using System.Threading;

namespace Imageo.ui
{
    public partial class LostPassword : System.Web.UI.Page
    {
        private static readonly ILog log = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);

        protected void Page_Load(object sender, EventArgs e)
        {
        }

        protected void btnRetrievePassword_Click(object sender, EventArgs e)
        {
            try
            {
                ServiceAPI service = new ServiceAPI();

                registerRequest req = new registerRequest();
                req.loginName = txtEmailAddress.Text.Trim();
                req.session = null;

                if (log.IsErrorEnabled) log.Debug("Calling: service.resendPassword(req)");
                registerResponse response = ServiceHelper.HandleBintjeErrors(this, service.resendPassword(req));

                tblDone.Visible = true;
                tblRetrieve.Visible = false;
            }
            catch (ThreadAbortException) { }
            catch (Exception exc)
            {
                if (log.IsErrorEnabled)
                {
                    log.Error(exc.Source + " - " + exc.Message);
                }
                Response.Redirect("~/UI/ErrorGeneric.aspx");
            }
        }
    }
}
